-- returns a power spectrum estimate of the real array R in the global array "transform". This routine multiplies R by a cosine window to reduce frequency spread. The output is scaled so that the sum over all frequencies is an estimate of the mean squared amplitude of the input.
r(t) = t*f-trunc(t*f)-.5 -- example function (sawtooth wave)